package com.hcb.tonguetiphealth.widget.more;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hcb.tonguetiphealth.view.R;
import com.hcb.tonguetiphealth.widget.BottomWidget;
import com.hcb.tonguetiphealth.widget.GeneralWidget;

public class StaticInfoWidget extends GeneralWidget implements OnClickListener {
	private static final String TAG = "StaticInfoWidget";

	private Activity ctx;

	private TextView tvInfo, tvTop;
	private LinearLayout llBack;

	private int fromFlag;//0：舌尖倡议；1：版本介绍；2：关于我们；3：应用场景

	public StaticInfoWidget(Context context) {
		super(context);
		ctx = (Activity) context;
		inflate(context, R.layout.static_info, this);

		fromFlag = ctx.getIntent().getIntExtra("fromFlag", 0);
		new BottomWidget(context, this);
		bindView();
		bindEvent();

	}

	private void bindView() {
		tvInfo = (TextView) findViewById(R.id.static_info_tv);
		tvTop = (TextView)findViewById(R.id.staticinfo_top_tv);
		llBack = (LinearLayout) findViewById(R.id.static_info_back);
		String strTop = "";
		String strInfo = "";
		switch (fromFlag) {
		case 0:
			strTop  = ctx.getResources().getString(R.string.more_propose);
			strInfo = ctx.getResources().getString(R.string.more_propose_info);
			break;
		case 1:
			strTop  = ctx.getResources().getString(R.string.more_version);
			strInfo = ctx.getResources().getString(R.string.more_version_info);
			break;
		case 2:
			strTop  = ctx.getResources().getString(R.string.more_aboutus);
			strInfo = ctx.getResources().getString(R.string.more_aboutus_info);
			break;
		case 3:
			strTop  = ctx.getResources().getString(R.string.more_environment);
			strInfo = ctx.getResources().getString(R.string.more_environment_info);
			break;
		default:
			break;
		}
		tvTop.setText(strTop);
		tvInfo.setText(strInfo);
	}

	private void bindEvent() {
		llBack.setOnClickListener(this);
	}

	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.static_info_back:
			ctx.setContentView(new MoreWidget(ctx));
			break;

		default:
			break;
		}
	}

	@Override
	public void notifyAdapter() {

	}
}
